using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.Persistent.Validation;
namespace Ascent.QiPei.Module.BusinessObjects.Finance
{
  [DefaultClassOptions]
  [DevExpress.Persistent.Base.NavigationItemAttribute("财务管理")]
  [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应付帐")]
  public partial class AccountPayable : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.String _gargoTeminalTelephone;
    private Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal _gargoTeminal;
    private System.String _remark;
    private System.Single _debtAmount;
    private System.Single _payabledAmount;
    private System.Single _payableAmount;
    private System.String _supplierTelphone;
    private Ascent.QiPei.Module.BusinessObjects.Base.Supplier _supplier;
    private System.String _aPYCode;
    public AccountPayable(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单号")]
    [RuleRequiredField(DefaultContexts.Save)]
    public System.String APYCode
    {
      get
      {
        return _aPYCode;
      }
      set
      {
        SetPropertyValue("APYCode", ref _aPYCode, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("供应商")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Supplier Supplier
    {
      get
      {
        return _supplier;
      }
      set
      {
          SetPropertyValue("Supplier", ref _supplier, value);
        //if (_supplier == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Supplier prevSupplier = _supplier;
        //_supplier = value;
        //if (IsLoading)
        //  return;
        //if (prevSupplier != null && prevSupplier.AccountPayable == this)
        //  prevSupplier.AccountPayable = null;
        //if (_supplier != null)
        //  _supplier.AccountPayable = this;
        //OnChanged("Supplier");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("供应商电话")]
    public System.String SupplierTelphone
    {
      get
      {
        return _supplierTelphone;
      }
      set
      {
        SetPropertyValue("SupplierTelphone", ref _supplierTelphone, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("货运站")]
    public Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal GargoTeminal
    {
      get
      {
        return _gargoTeminal;
      }
      set
      {
          SetPropertyValue("GargoTeminal", ref _gargoTeminal, value);
        //if (_gargoTeminal == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.GargoTeminal prevGargoTeminal = _gargoTeminal;
        //_gargoTeminal = value;
        //if (IsLoading)
        //  return;
        //if (prevGargoTeminal != null && prevGargoTeminal.AccountPayable == this)
        //  prevGargoTeminal.AccountPayable = null;
        //if (_gargoTeminal != null)
        //  _gargoTeminal.AccountPayable = this;
        //OnChanged("GargoTeminal");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("货运站电话")]
    public System.String GargoTeminalTelephone
    {
      get
      {
        return _gargoTeminalTelephone;
      }
      set
      {
        SetPropertyValue("GargoTeminalTelephone", ref _gargoTeminalTelephone, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("应付金额")]
    public System.Single PayableAmount
    {
      get
      {
        return _payableAmount;
      }
      set
      {
        SetPropertyValue("PayableAmount", ref _payableAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("已付金额")]
    public System.Single PayabledAmount
    {
      get
      {
        return _payabledAmount;
      }
      set
      {
        SetPropertyValue("PayabledAmount", ref _payabledAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("欠款金额")]
    public System.Single DebtAmount
    {
      get
      {
        return _debtAmount;
      }
      set
      {
        SetPropertyValue("DebtAmount", ref _debtAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remark
    {
      get
      {
        return _remark;
      }
      set
      {
        SetPropertyValue("Remark", ref _remark, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("AccountPayableItemses-AccountPayable")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("明细")]
    public XPCollection<Ascent.QiPei.Module.BusinessObjects.Finance.AccountPayableItems> AccountPayableItemses
    {
      get
      {
        return GetCollection<Ascent.QiPei.Module.BusinessObjects.Finance.AccountPayableItems>("AccountPayableItemses");
      }
    }
  }
}
